execute if entity @a[team=red] run scoreboard players add #success temp 1
execute if entity @a[team=blue] run scoreboard players add #success temp 1
execute if score #success temp matches 2.. run return run scoreboard players reset #success temp

scoreboard players reset #success temp
return fail